home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_03 / plauger / new1.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-12  |  357 b   |  14 lines

  1. Listing 2 -- The function operator new(size_t)
  2.  
  3. // operator new(size_t) REPLACEABLE function
  4. #include <stdlib.h>
  5. #include <new>
  6.  
  7. void *operator new(size_t size)
  8.         {       // try to allocate size bytes
  9.         void *p;
  10.         while ((p = malloc(size)) == 0 && _New_hand != 0)
  11.                 (*_New_hand)();
  12.         return (p);
  13.         }
  14.